from django.db import models


# Create your models here.
class Goods(models.Model):
    goods_name = models.CharField(verbose_name="商品名称", max_length=64)
    original_price = models.FloatField(verbose_name="原价", max_length=64, null=True, blank=True)
    present_price = models.FloatField(verbose_name="现价", max_length=64)
    image = models.FileField(verbose_name="缩略图", upload_to='goods_images', max_length=128, null=True,
                                         blank=True)
    store_name = models.CharField(verbose_name="店铺名称", max_length=64, null=True, blank=True)

    viewed = models.IntegerField(verbose_name='浏览次数', default=0, null=True, blank=True)

    def __str__(self):
        return f'[goods_name: {self.goods_name}, 原价/现价: {self.original_price}/{self.present_price}]'

    class Meta:
        verbose_name = "商品信息管理"
        verbose_name_plural = "商品信息管理"
